package common.db;

/**
 * Created by Gerardo on 1/25/14.
 */
public class UrlDb {
	private final String protocol;
	private final String subprotocol;
	private final String server;
	private final String port;
	private final String database;

	public UrlDb(final String protocol, final String subprotocol, final String server, final String port, final String database) {
		this.protocol = protocol;
		this.subprotocol = subprotocol;
		this.server = server;
		this.port = port;
		this.database = database;
	}

	public String toUrl() {
		StringBuilder builder = new StringBuilder();
		builder.append(protocol);
		builder.append(":");
		builder.append(subprotocol);
		builder.append("://");
		builder.append(server);
		builder.append(":");
		builder.append(port);
		builder.append("/");
		builder.append(database);
		return builder.toString();
	}
}
